package com.cam.framework.crud;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.List;

public abstract class CrudService<DTO extends CrudDTO, Entity extends CrudEntity, Mapper extends CrudMapper<DTO, Entity>> extends ServiceImpl<Mapper, Entity> {

    public DTO findById(String id) {
        return baseMapper.findById(id);
    }

    public List<DTO> findList(QueryWrapper<DTO> queryWrapper) {
        return baseMapper.findList(queryWrapper);
    }

    public IPage<DTO> findPage(QueryWrapper<DTO> queryWrapper, Page<DTO> page) {
        return baseMapper.findList(queryWrapper, page);
    }

}
